#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>

char* my_strncpy(char* dest, const char* src, size_t n)
{
	int i = 0;
	char* ret = dest;
	for (i = 0; i < n; i++)
	{
		*dest = *src;
		src++;
		dest++;
	}
	return dest;
}

int main()
{
	char arr1[10] = "abcdef";
	char arr2[10] = { 0 };
	my_strncpy(arr2, arr1, 4);
	printf("%s\n", arr2);
	return 0;
}